/*
请求地址:http
请求方法:
请求参数:
请求数据:
*/ 
var app= new Vue({
    el:"#div0",
    data:{
        city:'',
        weatherList:[],
        number :0,
        yesterday:"",
        suggest:"",
        suggest1:"",
        hour:[],
        weatherList1:[],
       isShow:false,
    },
    methods:{
       searchWeather:function(){
          // console.log('天气查询');
          //console.log(this.city);
           //保存this
           var that=this;
           axios.get('http://wthrcdn.etouch.cn/weather_mini?city='+this.city)
           .then(function(response){
            //console.log(response);
         console.log(response.data.data.forecast);
          that.weatherList=response.data.data.forecast;
         console.log(response.data.data.ganmao);
         that.yesterday=response.data.data.ganmao;
        
           })
           .catch(function(err){})
       },
       
       changeCity:function(city){
           this.city=city;
           this.searchWeather();
       },
  
       change: function (index) {
        this.number = index; 
      if(index==1){
        this.searchWeather1('福州'),
        this.changeIsShow()
      }else{this.searchWeather1('福州'),
    this.changeIsShow()
    }
      },
      searchWeather1:function(){
        var that=this;
        axios.get('https://tianqiapi.com/api?version=v1&appid=82972122&appsecret=LjrQR417&city='+this.city)
        .then(function(response){
        console.log(response);
         console.log(response.data.data[0].hours);
         that.hour=response.data.data[0].hours;
         console.log(response.data.data);
         that.weatherList1=response.data.data;
         console.log(response.data.data[0].air_tips);
         that.suggest=response.data.data[0].air_tips;
         console.log(response.data.data[0].index[0].desc);
         that.suggest1=response.data.data[0].index[0].desc;
         console.log(response.data.cityEn);
         that.city1=response.data.cityEn;
        })
        .catch(function(err){})
    },
  changeIsShow:function () {
    this.isShow=!this.isShow;
  }

    },
})
  